﻿using System;
using System.Windows.Controls;
using Bridge.Base.Constructs;

namespace Bridge.Objects
{
    /// <summary>
    /// CharacterView base class.
    /// </summary>
    public abstract class CharacterView : ChangableObject
    {
        /// <summary>
        /// Gets the Type of the Character.
        /// </summary>
        public abstract Type CharacterType { get; }

        /// <summary>
        /// Gets the name of the character.
        /// </summary>
        public abstract string Name { get; }
        
        /// <summary>
        /// Gets the current hit points of the character.
        /// </summary>
        public abstract int CurrentHP { get; }

        /// <summary>
        /// Gets the maximum hit points of the character.
        /// </summary>
        public abstract int MaxHP { get; }

        /// <summary>
        /// Gets the UserControl to use for displaying the information.
        /// </summary>
        public abstract UserControl EditCharacterUserControl { get; }

        /// <summary>
        /// Gets the base Character.
        /// </summary>
        public abstract Character BaseCharacter { get; }
    }

    /// <summary>
    /// CharacterView class for implementing in frameworks.
    /// </summary>
    /// <typeparam name="T">Type that implements <see cref="Character"/>for the view.</typeparam>
    public abstract class CharacterView<T> : CharacterView where T : Character
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CharacterView{T}"/> class.
        /// </summary>
        /// <param name="character"><see cref="Character"/> to add to the view.</param>
        public CharacterView(T character)
        {
            Character = character;
        }

        /// <summary>
        /// Gets the Character.
        /// </summary>
        public T Character
        {
            get { return mCharacter; }
            protected set { CheckPropertyChanged<T>("Character", ref mCharacter, ref value); }
        }

        /// <summary>
        /// Gets the base Character.
        /// </summary>
        public override Character BaseCharacter
        {
            get { return Character; }
        }
        
        /// <summary>
        /// Gets the Type of the Character for this view.
        /// </summary>
        public override Type CharacterType
        {
            get { return typeof(T); }
        }

        private T mCharacter;


    }
}
